# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
maintainer="team/kde <bribbers@disroot.org>"
pkgname=flatpak-kcm
pkgver=6.2.3
pkgrel=0
pkgdesc="Flatpak Permissions Management KCM"
# armhf blocked by qt6-qtdeclarative
arch="all !armhf"
url="https://kde.org/plasma-desktop/"
license="GPL-2.0-or-later"
depends="kirigami"
makedepends="
	extra-cmake-modules
	flatpak-dev
	kcmutils-dev
	kconfig-dev
	kdeclarative-dev
	ki18n-dev
	kitemmodels-dev
	qt6-qtdeclarative-dev
	qt6-qtsvg-dev
	samurai
	"
checkdepends="xvfb-run"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
subpackages="$pkgname-lang"
_repo_url="https://invent.kde.org/plasma/flatpak-kcm.git"
source="https://download.kde.org/$_rel/plasma/$pkgver/flatpak-kcm-$pkgver.tar.xz"
install_if="flatpak systemsettings"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# flatpakpermissiontest is broken
	xvfb-run -a ctest --test-dir build --output-on-failure -E "flatpakpermissiontest"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
1eb8173e4653e2ae36c6be17e3a489e5a5539368fabef1b9f1e52de9e051a1f7e622106ff719c1d43b30a01519d210d2877392939f1c4905ce6eff3c244aafa9  flatpak-kcm-6.2.3.tar.xz
"
